// noinspection JSUnresolvedVariable,JSUnusedGlobalSymbols,NodeCoreCodingAssistance

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {quasar, transformAssetUrls} from '@quasar/vite-plugin'


import {resolve} from 'path'

// https://vitejs.dev/config/
export default defineConfig({
    base: '/',
    plugins: [
        vue({
            template: {transformAssetUrls}
        }),
        quasar({
            sassVariables: 'src/quasar-variables.sass'
        })
    ],
    resolve: {
        alias: {
            "~/": `${resolve(__dirname, "src")}/`,
            "@/": `${resolve(__dirname, "src/views")}/`,
        },
    },
    server: {
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
            'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',

        },
        host: '0.0.0.0',
        port: 2063,
        // 反向代理
        proxy: {
            // string shorthand
            // with options
            '/admin': {
                target: 'http://127.0.0.1:8888',
                // target: 'http://10.7.129.45:9998',
                changeOrigin: true,
                // rewrite: (path) => path.replace(/^\/api/, '')
            },
            '/api/v1.0': {
                target: 'http://127.0.0.1:8888',
                // target: 'http://10.7.129.45:9998',
                changeOrigin: true,
                // rewrite: (path) => path.replace(/^\/api/, '')
            },
        }
    },
    // //生产模式打包配置
    build: {
        outDir: 'dingtalk_broadcast',//Specify the output directory (relative to project root).
        assetsDir: 'assets'
    },
})

